Accusoft.ImagXpress13.Net
Pass Image Data Between Different Accusoft Components

Traditionally, transferring image data between Accusoft components has required passing the image data in a DIB format. But, beginning with the release of ImagXpress 11, we are adding new methods throughout our products which allow you to easily copy or transfer image data between different Accusoft objects with just a single method call.

Regardless of its product or component assembly, any Accusoft image class which supports easily sending its image data to another Accusoft object will implement two methods: CopyTo(object destination) and TransferTo(object destination). And any Accusoft image class which supports easily receiving this image data (that is, being the destination object) will be noted in its class documentation.

A CopyTo method makes a complete copy of the image data. When called, both the source and destination objects will contain their own separate copies of identical image data. A TransferTo method, on the other hand, completely transfers the image data from one object to another. When finished, the source object will no longer contain image data; the image will be owned by the destination object.

Within the ImagXpress Suite

Within the ImagXpress suite of components, there are four classes which support sending their image data via CopyTo and TransferTo methods:

  1. ImagXpress - Accusoft.ImagXpressSdk.ImageX
  2. TwainPRO - Accusoft.TwainProSdk.ScannedImage
  3. ISIS Xpress - Accusoft.ISISXpressSdk.Output
  4. ThumbnailXpress - Accusoft.ThumbnailXpressSdk.ThumbnailItem

And within the ImagXpress suite of components, there is only one class which supports receiving image data: the ImagXpress ImageX class.

Other Accusoft products may contain additional classes which can send and receive image data.

How to Transfer Image Data from One ImageX Object to Another

Even within just the ImagXpress component, you can use this new approach to easily copy or transfer image data from one ImageX object to another.

Here's an example:

C# Example
Copy Code
using System.Drawing;
using Accusoft.ImagXpressSdk;

namespace ConsoleExample
{
    class Program
    {
        static void Main(string[] args)
        {
            using (ImagXpress ix = new ImagXpress())
            using (ImageX redImage = new ImageX(ix, 400, 400, 24, Color.Red))
            using (ImageX whiteImage = new ImageX(ix, 1200, 1200, 1, Color.White))
            {
                redImage.Save("original.bmp");
                whiteImage.TransferTo(redImage);
                redImage.Save("transferred.bmp");
            }
        }
    }
}

In the above example, we create a small, 24-bit red image object named redImage and save its image data to disk as "original.bmp". If you open this file, you will see a small red image.

Then, we create a large, 1-bit white image named whiteImage. But, instead of saving its data to disk directly, we first transfer its image data to the redImage object and then save the redImage instance's image data again, this time as "transferred.bmp". Since the image data inside of the whiteImage object was completely transferred to the redImage object, if you open this second file you will see a large white image.

See Also

 

 


©2018. Accusoft Corporation. All Rights Reserved.

Send Feedback